home *** CD-ROM | disk | FTP | other *** search
- Path: newsserver.rrzn.uni-hannover.de!tubsibr!duening
- From: duening@ibr.cs.tu-bs.de (Lars Duening)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: PPC compilers
- Date: 11 Jan 1996 22:36:09 GMT
- Organization: TU Braunschweig, Informatik (Bueltenweg), Germany
- Distribution: world
- Message-ID: <4d43cq$ifg@ra.ibr.cs.tu-bs.de>
- References: <john.hendrikx.40ka@grafix.xs4all.nl> <4b77tq$htp@serpens.rhein.de> <MQAQx*XOe@yaps.rhein.de> <4bqhnf$6g5@sunsystem5.informatik.tu-muenchen.de> <jasonb.820051107@cs.uwa.edu.au> <4c9i2l$h3i@sunsystem5.informatik.tu-muenchen.de> <4cf0ep$233@ra.i <4ck37m$g07@maureen.teleport.com> <4cs8ce$ljg@ra.ibr.cs.tu-bs.de> <4cujve$dmn@maureen.teleport.com>
- Reply-To: duening@ibr.cs.tu-bs.de (Lars Duening)
- NNTP-Posting-Host: kastor.ibr.cs.tu-bs.de
-
- In article <4cujve$dmn@maureen.teleport.com> sschaem@teleport.com (Stephan Schaem) writes:
- >Lars Duening (duening@ibr.cs.tu-bs.de) wrote:
- >: I need to know if it's a scalar type (further subdivided into integer
- >: and floating types), an array, a structure, a pointer or else, but I
- >: do not need to know it's exakt size in byte when using it.
- >
- > You need to know the type range... if you choose to ignore this, you
- > will have to select the largest type avail for real/interger.
-
- I still don't need to know or care about the _implementation_ and the
- _size_ - and that's what this discussion was about.
- Nobody denies that knowing the other type properties is still
- necessary (more or less).
-
- > But the point really is you need to know and keep track what your
- > variable are. basicly in asm you write what you are thinking,
- > but with a limited range of type and no typedef offered.
- >
- >: Sometimes I don't even need to know the exact type 'cause the compiler
- >: will create conversion code plus overflow checking (I'm not talking
- >: just C here).
- >
- > I think thats a bad practice... just for the fact that you let the
- > compiler tell you what you assumed wrong.
-
- I usually try to outsmart the compiler, but should I fail it's nice
- to know that the program won't go gaga.
- And look at this:
-
- a := SHORT(b);
-
- The compiler is instructed here to create conversion code to assign b
- to a. I still don't need to know if it's a longword->word, word->byte or
- even quadword->longword conversion. I _do_ know that I convert a
- scalar type to a smaller value range.
-
- >: > Otherwise you need to know that color0 is a word holding 12bit
- >: > of valid data grouped in 4bit nibles,
- >
- >: typedef struct {
- >: int r : 4;
- >: int g : 4;
- >: int b : 4;
- >: } color0_t;
- >
- >: color0_t color0;
- >
- > Now somewhere one should read the range of r,g,b... or you must
- > also provide a set of routine that will work on this structure/type
- > (Example: only value from 0 to 12 are valid. But you will make your
- > user function prototype use float and define the valid range)
-
- This is a completely different problem, and even that could be solved:
-
- TYPE COLOR0 = PACKED RECORD
- r, g, b : INTEGER [0..12];
- END;
-
- VAR color0 : COLOR0;
- --
- Lars Duening; duening@ibr.cs.tu-bs.de
-